home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Introducción a Windows Forms / InstantiateHelloWorld / InstantiateHelloWorld.cs next >
Encoding:
Text File  |  2001-01-15  |  814 b   |  26 lines

  1. //----------------------------------------------------
  2. // InstantiateHelloWorld.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class InstantiateHelloWorld
  9. {
  10.      public static void Main()
  11.      {
  12.           Form form   = new HelloWorld();
  13.           form.Text   = "Instantiate " + form.Text;
  14.           form.Paint += new PaintEventHandler(MyPaintHandler);
  15.  
  16.           Application.Run(form);
  17.      }
  18.      static void MyPaintHandler(object objSender, PaintEventArgs pea)
  19.      {
  20.           Form     form = (Form)objSender;
  21.           Graphics grfx = pea.Graphics;
  22.  
  23.           grfx.DrawString("Hello from InstantiateHelloWorld!", 
  24.                           form.Font, Brushes.Black, 0, 100);
  25.      }
  26. }